import { Controller, Delete, Get, Query } from '@nestjs/common';
import { SearchService } from './search.service';
import { SearchRequestDto, SearchResultDto } from '../dto/search.dto';

@Controller('/share')
export class SearchController {
  constructor(private readonly appService: SearchService) {}

  @Get('/records')
  async getRecords(@Query() data: SearchRequestDto): Promise<SearchResultDto> {
    return this.appService.getRecords(data);
  }

  @Delete('/record')
  async deleteRecord(@Query('hash') hash: string): Promise<void> {
    return this.appService.deleteRecord(hash);
  }
}
